/*
|--------------------------------------------------------------------------
| route/待我评分
|--------------------------------------------------------------------------
|
| author：陈胜云
| fetch：本页面的fetch、功能说明 
| DOTO:  考核类.考核项 => 考核点(可以左右切换) => 具体的被考核人
|
*/

import React, {PureComponent} from "react"
import {bindActionCreators} from "redux"
import {connect} from "react-redux"
import { Link } from 'react-router-dom';


/*ant 组件*/
import {Input, Button, Card, Menu, Dropdown, Icon, Row, Col, Tag} from "antd"
const Search = Input.Search;

/*数据交换*/
import { } from "libs/api/app"
import { fetchNowProject } from "./actions"

/*子模块*/
import { } from "./components/conponentsA"


/*css依赖*/
import "./style.less"



/*redux连接池*/
@connect(
    ({waitGrade}) => ({
    }),
    (dispatch) => (
      bindActionCreators({
        fetchNowProject
      }, dispatch)
    )
)
export default class WaitGrade extends PureComponent {
  state = {

  }

  menu = (
    <Menu onClick={()=>{}}>
      <Menu.Item key="1">全部状态</Menu.Item>
      <Menu.Item key="2">等待考核</Menu.Item>
      <Menu.Item key="3">考核完毕</Menu.Item>
    </Menu>
  )

  data = [
    {
      time:"2017年6月13日",
      list:[1,2,3,4]
    },
    {
      time:"2011年1月13日",
      list:[5,6,7,8,9,10]
    }
  ]

  render() {
    const {} = this.props;
    const {} = this.state;
    return (
      <div className="waitGrade">
          <div className="filter">
              <div className="slelect">
                  <Dropdown overlay={this.menu}>
                    <Button style={{ marginLeft: 8 }}>
                      全部状态 <Icon type="down" />
                    </Button>
                  </Dropdown>
                  <Dropdown overlay={this.menu}>
                    <Button style={{ marginLeft: 8 }}>
                      全部状态 <Icon type="down" />
                    </Button>
                  </Dropdown>
                  <Dropdown overlay={this.menu}>
                    <Button style={{ marginLeft: 8 }}>
                      全部状态 <Icon type="down" />
                    </Button>
                  </Dropdown>
                  <Dropdown overlay={this.menu}>
                    <Button style={{ marginLeft: 8 }}>
                      全部状态 <Icon type="down" />
                    </Button>
                  </Dropdown>
              </div>
              <div className="search">
                  <Search
                    placeholder="搜索考核项\点"
                    style={{ width: 200 }}
                    onSearch={value => console.log(value)}
                    />
              </div>
          </div>
          <div className="content">
            {
                this.data.map((item,index)=>{
                  return (
                        <Row gutter={16} key={index}>
                          <Col span={24}>
                              <p style={{marginTop:"15px"}}>{item.time}</p>
                          </Col>
                            {
                              item.list.map((item,index)=>{
                                return (
                                    <Col span={6} key={index}>
                                      <Card style={{ marginTop: '15px' }} bodyStyle={{padding:"15px 25px"}} title={(<p><Icon type="exception" className="titleIcon"/>分局综合考评考核</p>)} bordered={false} extra={<Tag color="#f50">日常勤务类</Tag>}>
                                          <label className="label">
                                            警容风纪{Math.random().toFixed(2)}
                                          </label>
                                          <p className="discribe">
                                            具体的一些考核标准的说明哟
                                          </p>
                                          <Button 
                                              type="primary"
                                              style={{display:"block",margin:"0 auto",marginTop:"15px"}}
                                              onClick={()=>this.toAssessPointDetails(item)}
                                              >
                                              立即考核
                                          </Button>
                                      </Card>
                                    </Col>
                                  )
                              })
                            }
                        </Row>
                    )
                })
            }
          </div>
      </div>
    )
  }
  componentDidMount() {

  }

  toAssessPointDetails = async (data) => {
    const {history} = this.props;
    await this.props.fetchNowProject(data);
    history.push('/index/assess/waitGrade/assessPointDetails')
  }


}
